package com.czy.owner.ui.workorder.orderviewholder;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.czy.owner.R;
import com.czy.owner.entity.MyOrderModel;
import com.czy.owner.entity.WorkOrderModel;
import com.czy.owner.utils.DecimalUtil;
import com.czy.owner.utils.StringUtils;
import com.czy.owner.utils.TimeUtils;
import com.czy.owner.widget.CountdownView;
import com.easyrecycleview.adapter.BaseViewHolder;


/**
 * Created hep on 2017/8/28.
 */
public class OrderCreateViewHolder2 extends BaseViewHolder<WorkOrderModel> {

    private Context ctx;
    private TextView tv_order_number, tv_order_state, tv_order_num, tv_order_service_time, tv_order_commodity_project, tv_order_item, tv_order_custom_commodity_project, tv_order_jishi,tv_store_name;
    private LinearLayout linear_order_num;

    public OrderCreateViewHolder2(ViewGroup parent, Context ctx) {
        super(parent, R.layout.item_order_created2);
        tv_order_number = $(R.id.tv_order_number);
        tv_order_state = $(R.id.tv_order_state);
        tv_order_num = $(R.id.tv_order_num);
        linear_order_num = $(R.id.linear_order_num);
        tv_store_name = $(R.id.tv_store_name);

        tv_order_service_time = $(R.id.tv_order_service_time);
        tv_order_commodity_project = $(R.id.tv_order_commodity_project);
        tv_order_item = $(R.id.tv_order_item);
        tv_order_custom_commodity_project = $(R.id.tv_order_custom_commodity_project);
        tv_order_jishi = $(R.id.tv_order_jishi);

        this.ctx = ctx;
    }

    @Override
    public void setData(WorkOrderModel model) {
        tv_store_name.setText(model.getStoreName());
        tv_order_number.setText("工单编号: " + model.getOrderNumber());
        tv_order_service_time.setText(model.getConvertServiceTime());
        if (model.getStoreBookingNumber() != null && !model.getStoreBookingNumber().isEmpty()) {
            if (linear_order_num.getVisibility() == View.GONE)
                linear_order_num.setVisibility(View.VISIBLE);
            tv_order_num.setText(model.getStoreBookingNumber());
        } else {
            if (linear_order_num.getVisibility() == View.VISIBLE)
                linear_order_num.setVisibility(View.GONE);
        }
        tv_order_commodity_project.setText(StringUtils.getString(model.getGoodsName(), "无"));
        tv_order_item.setText(StringUtils.getString(model.getAllServiceName(), "无"));
        tv_order_custom_commodity_project.setText(StringUtils.getString(model.getAllCustomName(), "无"));
        tv_order_jishi.setText(model.getLicenseNumber() + "  " + model.getChName());
//        tv_order_dingjing.setText("¥" + DecimalUtil.formatNum(model.getPayedDepositAmount() + ""));

    }


}
